//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_getlinepoints.sqf"
#include "x_setup.sqf"

private ["_startpoint", "_endpoint", "_radius", "_ret", "_curpoint", "_wpdist", "_wpangle", "_x1", "_y1"];
PARAMS_2(_startpoint,_endpoint);
_radius = if (count _this > 2) then {_this select 2} else {8000};
if (typeName _startpoint == "OBJECT") then {_startpoint = position _startpoint};
if (typeName _endpoint == "OBJECT") then {_endpoint = position _endpoint};
_ret = [];
_curpoint = _startpoint;
_wpdist = _curpoint distance _endpoint;
if (_wpdist > _radius) then {
	_wpangle = [_curpoint, _endpoint] call FUNC(DirTo);
	while {_wpdist > _radius} do {
		_x1 = (_curpoint select 0) + (_radius * sin _wpangle);
		_y1 = (_curpoint select 1) + (_radius * cos _wpangle);
		_curpoint = [_x1, _y1, 0];
		_wpdist = _curpoint distance _endpoint;
		_ret set [count _ret, _curpoint];
	};
};
_ret set [count _ret, [_endpoint select 1, _endpoint select 2, 0]];
_ret